package com.ywk.zzh.mongotest.config;

import com.ywk.zzh.mongotest.util.SnowflakeIdGenerator;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class SnowflakeConfig {

    @Bean
    public SnowflakeIdGenerator snowflakeIdGenerator() {
        // 实际生产环境中，机器ID和数据中心ID应该从配置文件或外部服务获取
        // 这里为演示使用固定值
        long workerId = 1L;
        long datacenterId = 1L;
        return new SnowflakeIdGenerator(workerId, datacenterId);
    }
}